package com.lindroy.todomvp.tasks

import android.app.Activity
import com.lindroy.todomvp.addtask.AddEditTaskActivity
import com.lindroy.todomvp.data.Task
import com.lindroy.todomvp.data.source.TasksRepository

/**
 * @author Lin
 * @date 2021/6/25
 * @function
 */
class TasksPresenter(
    val tasksRepository: TasksRepository? = null,
    val tasksView: TasksContract.View
) : TasksContract.Presenter {

    override var currentFiltering = TasksFilterType.ALL_TASKS

    private var firstLoad = true

    init {
        tasksView.presenter = this
    }

    override fun result(requestCode: Int, resultCode: Int) {
        if (AddEditTaskActivity.REQUEST_ADD_TASK ==
            requestCode && Activity.RESULT_OK == resultCode
        ) {
            tasksView.showSuccessfullySavedMessage()
        }
    }

    override fun loadTasks(forceUpdate: Boolean) {
    }

    override fun addNewTask() {
        tasksView.showAddTaskPage()
    }

    override fun openTaskDetails(requestedTask: Task) {
    }

    override fun completeTask(completedTask: Task) {
    }

    override fun activateTask(activeTask: Task) {
    }

    override fun clearCompletedTasks() {
    }

    override fun start() {
    }

}